
export default async (ctx,next) =>{
    const message = ctx.wxreq
    console.log('msg',message)
    if (message.MsgType === 'event'){
        if(message.Event === 'subscribe'){
            ctx.body = '欢迎订阅'
        }else if (message.Event === 'unsubscribe'){
            console.log('用户：%s取消订阅了。',message.FromUserName)
        }else if (message.Event === 'LOCATION'){
            ctx.body = '您的地理位置信息：'+ message.Longitude +' : '+ message.Latitude + '!'
        }
    } else if (message.MsgType === 'text'){
        ctx.body = message.Content
    }else if(message.MsgType === 'voice'){
        ctx.body = {
            type:'voice',
            mediaId:message.MediaId
        }
    }else if (message.MsgType === 'video'){
        ctx.body = {
            type:'video',
            mediaId:message.MediaId,
            title:'sdsd',
            description:'asas'
        }
    }else if (message.MsgType === 'image'){
        ctx.body = {
            type:'image',
            mediaId:message.MediaId
        }
    }else if (message.MsgType === 'location'){
        ctx.body = '您的地理位置是：'+ message.Location_X + ' : ' + message.Location_Y +'\n详细信息：'+ message.Label
    }else if (message.MsgType === 'link'){
        ctx.body= [{
            title:message.Title,
            description:message.Description,
            picurl:'http://mmbiz.qpic.cn/mmbiz_jpg/KMcNjUYxIIeeSarXicCyMicv9hFo68CJ4c9XH1bib4u2f6xuLukleibvvFOGqicUwicu3Q44qCjWc0P42klgOwz2bAiaw/0',
            url:message.Url
        }]
    }
   
}